package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.CommentUseService;
import com.ai.web.vo.CommentUseV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.CommentUse;
import com.tiny.persistence.repository.CommentUseRepo;

@Service
public class CommentUseServiceImpl extends BaseServiceImpl<CommentUse, Integer, CommentUseV> implements CommentUseService  {

    @Autowired
    private CommentUseRepo commentUseRepo;
    
    @Autowired
    public CommentUseServiceImpl(CommentUseRepo commentUseRepo) {
        super(commentUseRepo);
    }

    public CommentUseV getCommentUse(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveCommentUse(CommentUseV commentUseV) throws Exception {
        
        CommentUseV saveV = saveT(commentUseV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteCommentUses(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

}
